package lv.ante.dziesmas;

import java.awt.Frame;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;

@SuppressWarnings("serial")
public class ImageSize extends Frame {
	Image image;
	
	private int widthPx;
	private int heightPx;

	public int getWidthPx() {
		return widthPx;
	}

	public int getHeightPx() {
		return heightPx;
	}

	public ImageSize(String imageFile) throws InterruptedException {
		Toolkit tool = Toolkit.getDefaultToolkit();
		image = tool.getImage(imageFile);
		MediaTracker mTracker = new MediaTracker(this);
		mTracker.addImage(image, 1);
		mTracker.waitForID(1);
		widthPx = image.getWidth(null);
		heightPx = image.getHeight(null);
		System.out.println("widthPx = " + widthPx + ", heightPx = " + heightPx);
		
	}

}